import {emit} from 'network/request.js'
export function carPostData(goods){
    let json=JSON.stringify(goods)
    console.log('post',json);
  return emit({
    method:"post",
    url:'/addGood',
    headers:{
      'content-type':'application/json'  //如果写成contentType会报错
    },
    data:json
  })
}

export function carGetData(id){
  return emit({
    method:"get",
    url:"/getAllGood",
    params:{
      id
    }
  })
}

export function carDelData(userId,goodId){
  let json={
    userId,
    goodId,
    discount:"",
    price:"",
    num:"",
    name:"",
    img:""
  }
  let jsons=[]
  jsons.push(json)
  jsons=JSON.stringify(jsons)
  console.log(jsons);
  return emit({
    method:"post",
    url:"/deleteGood",
    headers:{
      'content-type':'application/json'  //如果写成contentType会报错
    },
    data:jsons
  })
}
